import axios from 'axios'

const baseUrl = 'http://music.cpengx.cn'

// 获取首页轮播图的API
// type:资源类型,对应以下类型,默认为 0 即 PC, 1: android, 2: iphone, 3: ipad
export function getBannerPic(type = 0) {
  return axios.get(`${baseUrl}/banner?type=${type}`)
}

// 获取首页发现好歌单轮播组件数据Api
// limit: 获取歌单数量, 默认为10
export function getMusicList(limit = 10) {
  return axios.get(`${baseUrl}/personalized?limit=${limit}`)
}

// 获取歌单详情Api
export function getMusicListDetail(id) {
  return axios.get(`${baseUrl}/playlist/detail?id=${id}`)
}

//获取歌词
export function getMusicLyric(id) {
  return axios.get(`${baseUrl}/lyric?id=${id}`)
}

// 搜索歌曲
export function searchMusic(keyword) {
  return axios.get(`${baseUrl}/cloudsearch?keywords=${keyword}`)
}

export default {
  getMusicLyric
}
